package com.cloudkinto.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.cloudkinto.enumType.order.allocate.AllocatePlanStatus;
import com.cloudkinto.enumType.order.allocate.AllocatePlanStockLockStatus;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 调拨发货计划
 * </p>
 *
 * @author long
 * @since 2025-03-11
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_allocate_plan")
public class AllocatePlanDo extends Model<AllocatePlanDo> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 租户id
     */
    @TableField(value = "tenant_id", fill = FieldFill.INSERT)
    private Long tenantId;

    /**
     * 客户id
     */
    @TableField(value = "company_id", fill = FieldFill.INSERT)
    private Long companyId;

    /**
     * 库存锁定状态   {@link AllocatePlanStockLockStatus}
     */
    @TableField("stock_lock_status")
    private Integer stockLockStatus;

    /**
     * 调拨计划编号
     */
    @TableField("plan_no")
    private String planNo;

    /**
     * 目的地类型 1FBA 2三方仓
     */
    @TableField("destination_type")
    private Integer destinationType;

    /**
     * 状态 {@link AllocatePlanStatus}
     */
    @TableField("status")
    private Integer status;

    /**
     * 地址簿id
     */
    @TableField("address_book_id")
    private Long addressBookId;

    /**
     * fba店铺id
     */
    @TableField("fba_shop_id")
    private Long fbaShopId;

    /**
     * fba店铺名
     */
    @TableField("fba_shop_name")
    private String fbaShopName;

    /**
     * 发货仓库id
     */
    @TableField("delivery_wh_id")
    private Long deliveryWhId;

    /**
     * 目标仓库id
     */
    @TableField("destination_wh_id")
    private Long destinationWhId;

    /**
     * 物流渠道id
     */
    @TableField("logistics_channel_id")
    private Long logisticsChannelId;

    /**
     * 物流跟踪号
     */
    @TableField("tracking_number")
    private String trackingNumber;

    /**
     * 总计划发货量
     */
    @TableField("total_plan_shipments")
    private Integer totalPlanShipments;

    /**
     * 总实际发货量
     */
    @TableField("total_actual_shipments")
    private Integer totalActualShipments;

    /**
     * 总计划箱数
     */
    @TableField("total_plan_box")
    private Integer totalPlanBox;

    /**
     * 总实际箱数
     */
    @TableField("total_actual_box")
    private Integer totalActualBox;

    /**
     * 参考单号
     */
    @TableField("reference_number")
    private String referenceNumber;

    /**
     * 附件
     */
    @TableField("file_ids")
    private String fileIds;

    /**
     * 批次备注
     */
    @TableField("remark")
    private String remark;

    /**
     * 预计到达日期
     */
    @TableField("expected_arrival_date")
    private Date expectedArrivalDate;

    /**
     * 预计到达时间
     */
    @TableField("expected_arrival_time")
    private String expectedArrivalTime;

    /**
     * 计划发货时间
     */
    @TableField("plan_shipment_time")
    private Date planShipmentTime;

    /**
     * 是否加急 0否 1是
     */
    @TableField("urgent")
    private Boolean urgent;

    /**
     * 是否打印 0否 1是
     */
    @TableField("print")
    private Boolean print;

    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 创建人
     */
    @TableField(value = "create_by", fill = FieldFill.INSERT)
    private Long createBy;

    @TableField(value = "create_by_name", fill = FieldFill.INSERT)
    private String createByName;

    @TableField(value = "delete_flag", fill = FieldFill.INSERT)
    @TableLogic
    private Integer deleteFlag;

    @TableField("push_wms_time")
    private Date pushWmsTime;

    @TableField("picking_push_time")
    private Date pickingPushTime;

    @TableField("picking_finish_time")
    private Date pickingFinishTime;

    @TableField("outbound_time")
    private Date outboundTime;

    @TableField("cancel_time")
    private Date cancelTime;

    @TableField("exception_time")
    private Date exceptionTime;

    @TableField("mark_exception_time")
    private Date markExceptionTime;

    @TableField("exception_reason")
    private String exceptionReason;

    @TableField("interception_flag")
    private Boolean interceptionFlag;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
